// keyof 获取类型的key值
interface IKun {
    name: string
    age: number
}

type ikunKeys = keyof IKun // name|age


function getObjectProperty<O, K extends keyof O>(obj: O, key: K) {
    return obj[key]
}

const info = {
    name: "lyy",
    age: 20,
    height: 1.88
}

getObjectProperty(info, "name")
getObjectProperty(info, "address")// 应该报错 但是没有

export { }